<?

/*
*
*   Excalibur Content Management System
*   Copyright © 2008 Egor "Sontan" Kuryanovich
*
*   Based on Explay Engine v2.0 by Golovdinov Alexander
*
*   Official site: www.excms.ru
*   Contact e-mail: support@excms.ru
*
*   GNU General Public License original source:
*   http://www.gnu.org/licenses/gpl-3.0.html
*
*/


header("Content-type: text/html; charset=utf-8");  
header("Cache-Control: no-cache");

$EXCMS = "work";

error_reporting (0);

include $_SERVER['DOCUMENT_ROOT']."/engine/settings.php";
include $_SERVER['DOCUMENT_ROOT']."/engine/mysql.class.php";
$db = new DB($server, $dbusername, $dbpassword, $dbname);
$db->connect();

if (!$mainsettings = $db->query ("SELECT * FROM site_main")) { print "<center><b>Невозможно взять данные из БД!<br>Обратитесь к администратору сайта!</b>"; exit; }
$SITE = $db->fetch_array ($mainsettings);
$theme = $SITE['site_theme'];
if (isset($_COOKIE['login']) && isset ($_COOKIE['pass']) && $_COOKIE['login'] != "false" && $_COOKIE['pass'] != "false") {
	$GLOBAL_USER_LOGIN = addslashes($_COOKIE['login']);
	$GLOBAL_USER_PASS = addslashes($_COOKIE['pass']);
	if ($GLOBAL_USER_LOGIN != "" && $GLOBAL_USER_PASS != "")
		$SELECT_USER = $db->query ("SELECT * FROM ".DB_PEREFIX."_users WHERE user_login = '$GLOBAL_USER_LOGIN' && user_password = '$GLOBAL_USER_PASS'");
	if ($db->num_rows ($SELECT_USER) == 1) {
		$GLOBAL_USER = $db->fetch_array ($SELECT_USER);
	}
}

if ($GLOBAL_USER['user_group'] != "admin" && ($GLOBAL_USER['moderator'] != 1 || $GLOBAL_USER['user_group'] != "admin")) exit;
if (!isset($_GET['id'])) exit;

$id = intval ($_GET['id']);

$db->query ("UPDATE ".DB_PEREFIX."_articles SET art_publik = 'yes' WHERE art_id = '$id'");
